using System;
using System.Collections.Generic;
using System.Text;

namespace Lapas.Common
{
    public partial class Helper
    {
        public static string ComputerName
        {
            get
            {
                try
                {
                    return System.Net.Dns.GetHostName();
                }
                catch
                {
                    return "Noname";
                }
            }
        }

        public static string ComputerIp
        {
            //20090915: tuanha--> them dk de lay IPV6
            get
            {
                string IP="";
                try
                {
                    foreach(System.Net.IPAddress ip in System.Net.Dns.GetHostEntry(ComputerName).AddressList)
                    {
                        if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                            IP = ip.ToString();
                    }
                    return IP;

                }
                catch
                {
                    return "0.0.0.0";
                }
            }
        }
    }
}
